<template>
    <div id="codeList" style="width: 100%">
        <el-table
                :data="data"
                :header-cell-style="tableHeader"
                border
                style="width: 100%"
        >
            <el-table-column
                    prop="id"
                    label="key"
                    sortable
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="codeDesc"
                    label="作用域"
                    min-width="180">
            </el-table-column>
            <el-table-column
                    prop="codeKey"
                    label="类型"
                    sortable
                    min-width="180">
            </el-table-column>
            <el-table-column
                    prop="keyDesc"
                    label="类型描述"
                    min-width="180">
            </el-table-column>
            <el-table-column
                    prop="codeValue"
                    label="编码值"
                    min-width="180">
            </el-table-column>
            <el-table-column
                    prop="valueDesc"
                    label="编码值描述"
                    min-width="180">
            </el-table-column>
            <el-table-column
                    label="操作"
                    align="center"
                    min-width="180"
            >
                <template slot-scope="scope">
                    <el-button type="info" size="mini" @click="codeShouldEdit(scope)">修改</el-button>
                    <el-button
                            size="mini"
                            type="danger"
                            @click="deleteCode(scope.row.id)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
    export default {
        name:"CodeList",
        props:{
            data:null
        },
        data(){
            return{
                tableHeader:{
                    "background-color":"#7fa1be99",
                    "color":"white",
                    "font-size":"18px"
                },
                columnData:{}
            }
        },
        methods:{
            codeShouldEdit(val){
                console.log(val)
                this.$emit("codeNeedEdit",val.row)
            },
            deleteCode(val){
                this.$emit("deleteCode",val)
            },
        }
    }
</script>

<style scoped>

</style>